#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>

#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include "testutils.h"

/*
 * +1 card
 * +1 Actions
 */
void great_hall_test(void)
{
	int i, j;
	int prev_great_hall_count;
	int prev_actions;
	struct gameState state;

	init_test_date(&state, 1);

	srand(time(NULL));

	for (i = 0; i < MAX_ITERATIONS; i++) {
		state.deckCount[0] = 50;
		for (j = 0; j < state.deckCount[0]; j++) {
			state.deck[0][j] = random_card();
		}

		state.handCount[0] = 5;
		for (j = 0; j < 4; j++) {
			state.hand[0][j] = random_card();
		}
		state.hand[0][4] = great_hall;

		prev_actions = state.numActions;
		prev_great_hall_count = card_count(state.hand[0], great_hall, state.handCount[0]);

		great_hall_effect(&state, 0, 4);

		assert(card_count(state.hand[0], great_hall, state.handCount[0]) == prev_great_hall_count -1);
		assert(state.numActions == prev_actions + 1);
		assert(state.handCount[0] == 6);
	}
}

int main(int argc, char const *argv[])
{
	great_hall_test();
	return 0;
}